[IA64] linux: XENMEM op work around
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Tue, 9 May 2006 17:47:15 +0000 (11:47 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Tue, 9 May 2006 17:47:15 +0000 (11:47 -0600)
xen/ia64 XENMEM_increase_reservation, XENMEM_decrease_reservation,
XENMEM_populate_reservation are broken.
work around for it.
This patch should be removed after those hypercalls are fixed.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h

index e6b082a31ec7b4e7b15b65b3091a39fc0eee52d4..403d2235a3168d53435fd617f8567bff2e1bc2f8 100644 (file)
 #define balloon_unlock(flags)  ((void)flags)
 #endif
 
+//XXX xen/ia64 copy_from_guest() is broken.
+//    This is a temporal work around until it is fixed.
+//    used by balloon.c netfront.c
+int
+ia64_xenmem_reservation_op(unsigned long op,
+                          struct xen_memory_reservation* reservation__)
+{
+       struct xen_memory_reservation reservation = *reservation__;
+       unsigned long* frame_list = reservation__->extent_start;
+       unsigned long nr_extents = reservation__->nr_extents;
+       int ret = 0;
+
+       BUG_ON(op != XENMEM_increase_reservation &&
+              op != XENMEM_decrease_reservation &&
+              op != XENMEM_populate_physmap);
+
+       while (nr_extents > 0) {
+               int tmp_ret;
+               volatile unsigned long dummy;
+
+               reservation.extent_start = frame_list;
+               reservation.nr_extents = nr_extents;
+
+               dummy = frame_list[0];// re-install tlb entry before hypercall
+               tmp_ret = ____HYPERVISOR_memory_op(op, &reservation);
+               if (tmp_ret < 0) {
+                       if (ret == 0) {
+                               ret = tmp_ret;
+                       }
+                       break;
+               }
+               frame_list += tmp_ret;
+               nr_extents -= tmp_ret;
+               ret += tmp_ret;
+       }
+       return ret;
+}
 
 //XXX same as i386, x86_64 contiguous_bitmap_set(), contiguous_bitmap_clear()
 // move those to lib/contiguous_bitmap?
index d81e4d1598b3db45a80bb6d3a02f1da686e2aa4d..eba05a4c33542550909e6f6cb3c9bffe053ef008 100644 (file)
@@ -195,12 +195,42 @@ HYPERVISOR_multicall(
     return _hypercall2(int, multicall, call_list, nr_calls);
 }
 
+#ifndef CONFIG_XEN_IA64_DOM0_VP
 static inline int
 HYPERVISOR_memory_op(
     unsigned int cmd, void *arg)
 {
     return _hypercall2(int, memory_op, cmd, arg);
 }
+#else
+//XXX xen/ia64 copy_from_guest() is broken.
+//    This is a temporal work around until it is fixed.
+static inline int
+____HYPERVISOR_memory_op(
+    unsigned int cmd, void *arg)
+{
+    return _hypercall2(int, memory_op, cmd, arg);
+}
+
+#include <xen/interface/memory.h>
+int ia64_xenmem_reservation_op(unsigned long op,
+                  struct xen_memory_reservation* reservation__);
+static inline int
+HYPERVISOR_memory_op(
+    unsigned int cmd, void *arg)
+{
+    switch (cmd) {
+    case XENMEM_increase_reservation:
+    case XENMEM_decrease_reservation:
+    case XENMEM_populate_physmap:
+        return ia64_xenmem_reservation_op(cmd, 
+                                          (struct xen_memory_reservation*)arg);
+    default:
+        return ____HYPERVISOR_memory_op(cmd, arg);
+    }
+    /* NOTREACHED */
+}
+#endif
 
 static inline int
 HYPERVISOR_event_channel_op(